import api from '@/http/api.js'
export default{
    namespaced:true,
    state:{
        rows:[],
        pages:0,
        total:0
    },
    mutations:{
        SET_STUDENT(state,payload){
                Object.assign(state,payload)
        }
    },
    actions:{
      async  getStudentsAsync(context,payload){
            
               const {data}=await api.student.getStudent(payload)
               console.log(data);
               if(data.code){
                    context.commit('SET_STUDENT',data.data)
               }
         },
      async  addStudentsAsync(context,payload){
               const {data}=await api.student.addStudent(payload)
                        return data
                  
        
         },
      async  delStudentsAsync(commit,payload){
               const {data}=await api.student.delStudent(payload)
                        return data
                  
        
         },
      async  getOneAsync(commit,payload){
               const {data}=await api.student.getOne(payload)
                     return data
                  
        
         },
      async  makeUpdateAsync(commit,payload){
               const {data}=await api.student.studentUpdate(payload)
                     return data
                  
        
         },


    }
}